package com.wc.AlgoOJ_homework.ALgoOJ_BL5.B_01串的熵;

/**
 * @Author congge
 * @Date 2024/4/10 18:57
 * @description http://43.138.190.70:8888/p/LQ1407?tid=66120c2c07c5c018a5dcf262
 */
public class Main {
    public static void main(String[] args) {
        int n = 23333333;
        int num = 1;
        while (Math.abs(get(num, n - num) - 11625907.5798) >= 1e-4) {
            num++;
        }
        System.out.println(get(11027421,n - 11027421));
    }

    static double get(double l, double r) {
        return -l * l / (l + r) * log2(l / (l + r)) - r * r / (l + r) * log2(r / (l + r));
    }

    static double log2(double x) {
        return Math.log(x) / Math.log(2);
    }
}
